//
//  MTCamera.h
//  MiTu
//
//  Created by CY on 15/11/24.
//  Copyright © 2015年 CY. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

typedef enum : NSUInteger {
    CameraPositionBack,
    CameraPositionFront
} CameraPosition;

typedef enum : NSUInteger {
    CameraFlashOn,
    CameraFlashOff
} CameraFlash;

typedef enum : NSUInteger {
    CameraQualityLow,
    CameraQualityMedium,
    CameraQualityHigh,
    CameraQualityPhoto
} CameraQuality;

@class MTCamera;

@protocol MTCameraDelegate <NSObject>

- (void)cameraViewController:(MTCamera *)cameraVC
             didChangeDevice:(AVCaptureDevice *)device;

- (void)cameraViewController:(MTCamera *)cameraVC
             didCaptureImage:(UIImage *)image;

@end

@interface MTCamera : UIViewController

@property (nonatomic, weak) id<MTCameraDelegate> delegate;

@property (nonatomic) CameraFlash cameraFlash; // 打开/关闭闪光灯

@property (nonatomic) CameraPosition cameraPosition; // 前置/后置摄像头

- (instancetype)initWithQuality:(CameraQuality)quality;

- (void)start;

- (void)stop;

- (void)attachToViewController:(UIViewController *)vc withDelegate:(id<MTCameraDelegate>)delegate;

- (CameraPosition)togglePosition;

- (CameraFlash)toggleFlash;

- (BOOL)isFlashAvailable;

- (void)capture;

@end









